{extend name="layout" /}

{block name="content"}
    <div class="row">
        <div class="col-md-12">
            <div class="block">
                {notempty name="tab_nav"}
                <ul class="nav nav-tabs">
                    {volist name="tab_nav['tab_list']" id="tab"}
                    <li {eq name="tab_nav.curr_tab" value="$key"}class="active"{/eq}>
                        <a href="{$tab.url}">{$tab.title}</a>
                    </li>
                    {/volist}
                    <li class="pull-right">
                        <ul class="block-options push-10-t push-10-r">
                            <li>
                                <a href="{:url('index', ['type' => $type])}"><i class="si si-{$type=='list' ? 'list' : 'grid'}"></i></a>
                            </li>
                            <li>
                                <button type="button" data-toggle="block-option" data-action="fullscreen_toggle"></button>
                            </li>
                        </ul>
                    </li>
                </ul>
                {else/}
                <div class="block-header bg-gray-lighter">
                    <ul class="block-options">
                        <li>
                            <button type="button" data-toggle="block-option" data-action="fullscreen_toggle"></button>
                        </li>
                        <li>
                            <button type="button" data-toggle="block-option" data-action="refresh_toggle" data-action-mode="demo"><i class="si si-refresh"></i></button>
                        </li>
                        <li>
                            <button type="button" data-toggle="block-option" data-action="content_toggle"></button>
                        </li>
                        <li>
                            <button type="button" data-toggle="block-option" data-action="close"><i class="si si-close"></i></button>
                        </li>
                    </ul>
                    <h3 class="block-title">{$page_title}</h3>
                </div>
                {/notempty}
                <div class="block-content tab-content">
                    <div class="tab-pane active">
                        <div class="row push-20">
                            <div class="col-md-12">
                                <div class="pull-right search-bar">
                                    <form class="input-group">
                                        <span class="input-group-addon"><i class="fa fa-search"></i></span>
                                        <input type="text" class="form-control" value="{:input('get.keyword')}" name="keyword" placeholder="请输入标识/名称/作者">
                                    </form>
                                </div>

                                <div class="toolbar-btn-action">
                                    <a title="全部" class="btn btn-default" href="{:url('index')}">全部({$total.all|default='0'})</a>
                                    <a title="已启用" class="btn btn-success" href="{:url('index', ['status' => '1'])}">已启用({$total['1']|default='0'})</a>
                                    <a title="已禁用" class="btn btn-warning" href="{:url('index', ['status' => '0'])}">已禁用({$total['0']|default='0'})</a>
                                    <a title="未安装" class="btn btn-info" href="{:url('index', ['status' => '-1'])}">未安装({$total['-1']|default='0'})</a>
                                    <a title="已损坏" class="btn btn-danger" href="{:url('index', ['status' => '-2'])}" id="hide_disable">已损坏({$total['-2']|default='0'})</a>
                                </div>
                            </div>
                        </div>
                        <div class="row module-list push-20">
                            {empty name="modules"}
                            <div class="table-empty">
                                <div class="text-center empty-info">
                                    <i class="fa fa-database"></i> 暂无数据<br>
                                </div>
                            </div>
                            {/empty}
                            {eq name="type" value="block"}
                            {volist name="modules" id="module"}
                            <div class="col-sm-6 col-md-4 col-lg-3">
                                <div class="block block-rounded">
                                    <div class="block-content block-content-full text-center bg-{$module.bg_color|default='danger'} ribbon ribbon-bookmark ribbon-crystal">
                                        <div class="ribbon-box font-w600">{$module.version|default='无版本号'}</div>
                                        <div class="item item-2x item-circle bg-crystal-op push-20-t push-20 visibility-hidden" data-toggle="appear" data-offset="50" data-class="animated fadeIn">
                                            <i class="{$module.icon|default='fa fa-puzzle-piece'} text-white-op"></i>
                                        </div>
                                        <h3 class="h4 text-white">{$module.title|default='无模块标题'}</h3>
                                        <div class="text-white-op">
                                            <em>{$module.name|default=''}</em>
                                        </div>
                                    </div>
                                    <div class="block-content bg-gray-lighter">
                                        <div class="{$module.status_class} pull-right push-10-l">{$module.status_info}</div>
                                        <div class="push-10">
                                            <a class="h5" href="{$module.author_url|default=''}" target="_blank"><i class="fa fa-user"></i> {$module.author|default=''}</a>
                                        </div>
                                        <div class="push-10 mheight-100">
                                            <div data-toggle="slimscroll" data-height="110px">
                                                <p class="text-gray-dark">{$module.description|default='暂无简介'}</p>
                                            </div>
                                        </div>
                                        <div class="text-center push">
                                            {$module.actions}
                                        </div>
                                    </div>
                                </div>
                            </div>
                            {/volist}
                            {else/}
                                {notempty name="modules"}
                                <div class="col-md-12">
                                    <div class="table-responsive">
                                        <table class="table table-builder table-hover table-bordered table-striped">
                                            <thead>
                                            <tr>
                                                <th>名称</th>
                                                <th>图标</th>
                                                <th>版本</th>
                                                <th>作者</th>
                                                <th>简介</th>
                                                <th class="column-right_button">操作</th>
                                            </tr>
                                            </thead>
                                            <tbody>
                                            {volist name="modules" id="module"}
                                            <tr>
                                                <td>{$module.title|default='无模块标题'}</td>
                                                <td><i class="{$module.icon|default='fa fa-puzzle-piece'}"></i></td>
                                                <td>{$module.version|default='无版本号'}</td>
                                                <td><a href="{$module.author_url|default=''}" target="_blank">{$module.author|default=''}</a></td>
                                                <td>{$module.description|default='暂无简介'}</td>
                                                <td>{$module.actions}</td>
                                            </tr>
                                            {/volist}
                                            </tbody>
                                        </table>
                                    </div>
                                </div>
                                {/notempty}
                            {/eq}
                        </div>
                        <div class="data-table-toolbar">
                            <div class="row">
                                <div class="col-sm-12">
                                    {// 分页 }
                                    {notempty name="pages"}
                                    {$pages}
                                    {/notempty}
                                    {notempty name="row_list"}
                                    <div class="pagination-info pull-right">
                                        <form action="" method="get">
                                            <input type="text" class="form-control input-sm go-page" name="page" value="{:input('param.page', '1')}">
                                            <input type="text" class="form-control input-sm nums" name="list_rows" value="{php}echo input('param.list_rows', '') == '' ? config('list_rows') : input('param.list_rows');{/php}">
                                            <input type="submit" class="hidden">
                                            / <strong>{$row_list->lastPage()}</strong> 页，共 <strong>{$row_list->total()}</strong> 条数据，每页显示数量
                                        </form>
                                    </div>
                                    {/notempty}
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
{/block}